<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>MeteoCal</title>
        <link type="text/css" rel="stylesheet" href="resources/css/view_cuEvent.css" />
    </h:head>
    <body>
         
        <h:form>
            <p:panel rendered="#{eventBean.par != 'err' and eventBean.retrieve}" id="event" header="Event Details" style="width: 96%; margin: 3% auto; height: 560px">
                <p:messages rendered="#{!eventBean.update}" id="message"  showDetail="true" autoUpdate="true" closable="false" style="margin: 45px" >
                    #{eventBean.msgInfo()}
                </p:messages>
                <div style="float: left; margin: 40px 40px auto 20px; width: 45%">
                    <p:panelGrid columns="2" columnClasses="column1,column2" style="float: bottom">
                        <p:outputLabel for="NameOut" value="Name:"/>
                        <h:outputText id="NameOut" value="#{eventBean.getName()}" />

                        <p:outputLabel for="DescriptionOut" value="Description:" />
                        <h:outputText id="DescriptionOut" value="#{eventBean.getDescription()}" />

                        <p:outputLabel for="CityOut" value="City:" />
                        <h:outputText id="CityOut" value="#{eventBean.getCity()}"  />

                        <p:outputLabel for="AddressOut" value="Address" />
                        <h:outputText id="AddressOut" value="#{eventBean.getAddress()}" />

                        <p:outputLabel for="DateBeginOut" value="Date Begin:" />
                        <h:outputText id="DateBeginOut" 
                                      value="#{eventBean.getDateBegin().getDate()}/#{eventBean.getDateBegin().getMonth()+1}/#{eventBean.getDateBegin().getYear()+1900}" />

                        <p:outputLabel for="DateEndOut" value="Date End:" />
                        <h:outputText id="DateEndOut" 
                                      value="#{eventBean.getDateEnd().getDate()}/#{eventBean.getDateEnd().getMonth()+1}/#{eventBean.getDateEnd().getYear()+1900}" />

                        <p:outputLabel for="timeBeginOut" value="Time Begin:" />
                        <h:outputText id="timeBeginOut" value="#{eventBean.getHourBegin().getHours()}h #{eventBean.getHourBegin().getMinutes()}m" />

                        <p:outputLabel for="timeEndOut" value="Time End:" />
                        <h:outputText id="timeEndOut" value="#{eventBean.getHourEnd().getHours()}h #{eventBean.getHourEnd().getMinutes()}m" />

                    </p:panelGrid>
                    
                    <p:commandButton value="Update" action="#{eventBean.ClickOnUpdate()}" rendered="#{eventBean.isCreator()}" style="margin: 75px 25px auto auto"/>
                    <p:commandButton value="Delete" action="#{eventBean.ClickOnDelete()}" rendered="#{eventBean.isCreator()}" style="margin: 75px 220px auto auto">
                        <p:confirm header="Confirmation" message="Are you sure?" icon="ui-icon-alert"/>
                    </p:commandButton>
                    <p:commandButton value="Homepage" action="homepage?faces-redirect=true" style="margin: 75px auto auto auto"/>
                </div>
                       
                <p:panelGrid id="part" columns="2" columnClasses="column1,column3" style="float: bottom;  width: 48%; margin: 40px auto 10px; white-space: nowrap;">
                    <p:outputLabel for="participant" value="Participant(s):" />
                    <p:dataList id="participant" value="#{eventBean.getParticipant()}" var="x" emptyMessage="" type="none">
                        <b>. </b><h:outputText id="partec" value="#{x.getEmail()} | #{x.getName()} #{x.getSurname()}" /><br />                          
                    </p:dataList>
                </p:panelGrid>    
                <p:panelGrid columns="2" columnClasses="column1,column2" style="width: 35%; margin: 15px 20px 50px;float: left ">
                    <p:outputLabel for="publicprivate" value="Public" />
                    <h:outputText id="publicprivate" value="#{eventBean.getPublic1()==false ? 'No' : 'Yes'}" />

                    <p:outputLabel for="outdoor" value="Outdoor:" />
                    <h:outputText id="outdoor" value="#{eventBean.getOutdoor()==false ? 'No' : 'Yes'}" />
                    
                    <p:outputLabel for="creator" value="Creator:" rendered="#{not eventBean.isCreator()}" />
                    <h:outputText id="creator" value="#{eventBean.e.name} #{eventBean.e.name}" rendered="#{not eventBean.isCreator()}"/>
                </p:panelGrid>
                <p:graphicImage value="#{eventBean.weatherRetrieve()}" style="margin: 30px auto auto 5px" />
       
            </p:panel>
                      
            <p:panel rendered="#{eventBean.par == 'err' or !eventBean.retrieve}" header="Event Details" style="width: 96%; margin: 3% auto; height: 560px;">
                <p:messages id="messages"  showDetail="true" autoUpdate="true" closable="false" style="margin-top: 45px">
                    #{eventBean.msgInfo()}
                </p:messages>
                <p:commandButton value="Back" onclick="history.go(-1);return false;" style="margin: 45px 30px auto auto"/>
                <p:commandButton value="Homepage" action="homepage?faces-redirect=true" style="margin: 45px auto auto auto"/>
            </p:panel>
            
            <p:confirmDialog global="true" showEffect="fade" hideEffect="explode">
                <p:commandButton value="Yes" type="button" onclick="PrimeFaces.monitorDownload(start, stop);" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" style="margin: 0 10px 0 30px"/>
                <p:commandButton value="No" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" style="margin: 0 30px 0 10px"/>
            </p:confirmDialog>
            <p:dialog modal="true" widgetVar="statusDialog" showEffect="explode" header="Deleting the event" draggable="false" closable="true" resizable="false">
                <p:panelGrid columns="2" style="vertical-align: central" >
                    <p:row><h:graphicImage library="images" name="progress.BAK-FOURTH.gif" /></p:row>
                    <p:row>Please, wait...</p:row>
                </p:panelGrid>
            </p:dialog>
            <script type="text/javascript">
                function start() {
                    PF('statusDialog').show();
                }

                function stop() {
                    PF('statusDialog').hide();
                }
            </script>
         </h:form>
    </body>
</html>
